import 'package:flutter/material.dart';
import 'package:get/get.dart';

class CounterController extends GetxController {
  var count = 0.obs;

  increment() => count++;
}

class Counter extends StatelessWidget {
  Counter({Key? key}) : super(key: key);

  final CounterController c = Get.put(CounterController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar:
            AppBar(title: Obx(() => SelectableText("就是简单的一个计数器：${c.count}"))),
        floatingActionButton: FloatingActionButton(
            child: Icon(Icons.add), onPressed: c.increment));
  }
}

